package com.ruoyi.swimming.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.swimming.domian.MallOrder;
import com.ruoyi.swimming.domian.Natatorium;
import com.ruoyi.swimming.mapper.MallOrderMapper;
import com.ruoyi.swimming.mapper.NatatoriumMapper;
import com.ruoyi.swimming.service.INatatoriumService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Arrays;
import java.util.List;

/**
 * 泳馆Service业务层处理
 * 
 * @author ruoyi
 * @date 2021-07-17
 */
@Service
public class NatatoriumServiceImpl extends ServiceImpl<NatatoriumMapper, Natatorium> implements INatatoriumService
{
    @Autowired
    private NatatoriumMapper natatoriumMapper;

    /**
     * 查询泳馆
     * 
     * @param id 泳馆ID
     * @return 泳馆
     */
    @Override
    public Natatorium selectNatatoriumById(Long id)
    {
        return natatoriumMapper.selectNatatoriumById(id);
    }

    /**
     * 查询泳馆列表
     * 
     * @param natatorium 泳馆
     * @return 泳馆
     */
    @Override
    public List<Natatorium> selectNatatoriumList(Natatorium natatorium)
    {
        return natatoriumMapper.selectNatatoriumList(natatorium);
    }

    /**
     * 新增泳馆
     * 
     * @param natatorium 泳馆
     * @return 结果
     */
    @Override
    public int insertNatatorium(Natatorium natatorium)
    {
        natatorium.setCreateTime(DateUtils.getNowDate());
        return natatoriumMapper.insert(natatorium);
    }

    /**
     * 修改泳馆
     * 
     * @param natatorium 泳馆
     * @return 结果
     */
    @Override
    public int updateNatatorium(Natatorium natatorium)
    {
        natatorium.setUpdateTime(DateUtils.getNowDate());
        return natatoriumMapper.updateById(natatorium);
    }

    /**
     * 批量删除泳馆
     * 
     * @param ids 需要删除的泳馆ID
     * @return 结果
     */
    @Override
    public int deleteNatatoriumByIds(Long[] ids)
    {
        return natatoriumMapper.deleteBatchIds(Arrays.asList(ids));
    }

    /**
     * 删除泳馆信息
     * 
     * @param id 泳馆ID
     * @return 结果
     */
    @Override
    public int deleteNatatoriumById(Long id)
    {
        return natatoriumMapper.deleteById(id);
    }
}
